package com.jeesite.modules.banuser.banrecord.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

import java.io.Serial;
import java.util.Date;

/**
 * banrecordEntity
 * @author k
 * @version 2025-08-21
 */
@Table(name="banrecord", alias="a", label="banrecord信息", columns={
		@Column(name="id", attrName="tid", label="id", isPK=true),
		@Column(name="player_name", attrName="playerName", label="player_name", queryType=QueryType.LIKE),
		@Column(name="uuid", attrName="uuid", label="uuid"),
		@Column(name="reason", attrName="reason", label="reason"),
		@Column(name="ban_date", attrName="banDate", label="ban_date"),
		@Column(name="un_ban_date", attrName="unBanDate", label="un_ban_date", isUpdateForce=true),
	}, orderBy="a.id DESC"
)
public class BanRecord extends DataEntity<BanRecord> {
	
	@Serial
	private static final long serialVersionUID = 1L;
	private Long tid;		// id
	private String playerName;		// player_name
	private Long uuid;		// uuid
	private String reason;		// reason
	private Date banDate;		// ban_date
	private Date unBanDate;		// un_ban_date

	public BanRecord() {
		this(null);
	}
	
	public BanRecord(String id){
		super(id);
	}
	
	@JsonSerialize(using = ToStringSerializer.class)
	public Long getTid() {
		return tid;
	}

	public void setTid(Long tid) {
		this.tid = tid;
	}
	
	@NotBlank(message="player_name不能为空")
	@Size(min=0, max=50, message="player_name长度不能超过 50 个字符")
	public String getPlayerName() {
		return playerName;
	}

	public void setPlayerName(String playerName) {
		this.playerName = playerName;
	}
	
	@NotNull(message="uuid不能为空")
	public Long getUuid() {
		return uuid;
	}

	public void setUuid(Long uuid) {
		this.uuid = uuid;
	}
	
	@NotBlank(message="reason不能为空")
	@Size(min=0, max=200, message="reason长度不能超过 200 个字符")
	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
	@NotNull(message="ban_date不能为空")
	public Date getBanDate() {
		return banDate;
	}

	public void setBanDate(Date banDate) {
		this.banDate = banDate;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
	public Date getUnBanDate() {
		return unBanDate;
	}

	public void setUnBanDate(Date unBanDate) {
		this.unBanDate = unBanDate;
	}

	@Override
	public String toString() {
		return "BanRecord{" +
				"tid=" + tid +
				", playerName='" + playerName + '\'' +
				", uuid=" + uuid +
				", reason='" + reason + '\'' +
				", banDate=" + banDate +
				", unBanDate=" + unBanDate +
				'}';
	}
}